const jwt = require("./jwt");
module.exports = function checkUser(req, res) {
    let { user_id } = req.body;
    const user = jwt.verify(req);
    if (!user) {
      result = {
        code: "401",
        msg: "用户名没有登录，重新登录",
      };
      res.send(result);
      return false;
    }
    if (user.user_id != user_id) {
      result = {
        code: "402",
        msg: "用户名不匹配，请重新登录",
      };
      res.send(result);
      return false;
    }
    return true;
  }